<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<%@include file="../base/frameBase.jsp" %>
<body>
	<div>
	<fieldset class="layui-elem-field" style="width:99%">
 	 <legend>管理员账户创建</legend>
		<form class="layui-form layui-form-pane" action="" style="margin-left:20px;margin-top:20px;margin-bottom:10px">
			<table>
			<tr>
				   
				<td>
				<div class="layui-form-item">
	  				  <label class="layui-form-label">姓名</label>
	   				  <div class="layui-input-inline">
	   				  <input type="text" name="loginName" lay-verify="required" placeholder="刘xx" autocomplete="off" class="layui-input">
	                 </div>
	            </div>
				</td>
				<td> 
					<div class="layui-form-item">
		  				  <label class="layui-form-label">电话号码</label>
		   				  <div class="layui-input-inline">
		   				  <input type="text" name="phoneNumber" lay-verify="required" placeholder="157XXXXXXX" autocomplete="off" class="layui-input">
		                 </div>
		            </div>
				</td>
				<td><div class="layui-form-item">
		  				  <label class="layui-form-label">密码</label>
		   				  <div class="layui-input-inline">
		   				  <input type="password" name="loginPwd" lay-verify="required" placeholder="xxxxx" autocomplete="off" class="layui-input">
		                 </div>
		            </div>
		            </td>
				<td><div class="layui-form-item">
					<button onclick="createAdmin()" class="layui-btn">创建</button>
				</div>
				</td>
			</tr>
			<tr></tr>
		</table>	
		</form>
		</fieldset>
</div>
<script type="text/javascript">
layui.use('layer', function(){
	var layer=layui.layer;
});
//注册
function  createAdmin(){
	var loginName =	$("input[name='loginName']").val(); //用户名
	var phoneNumber = $("input[name='phoneNumber']").val();  //电话号码
	var loginPwd = $("input[name='loginPwd']").val();  //注册密码
	var createAdminInfo ={};
	$(createAdminInfo).attr({
		"userName" : loginName
	});
	$(createAdminInfo).attr({
		"phoneNumber" : phoneNumber
	});
	$(createAdminInfo).attr({
		"password" : loginPwd
	});
		$.ajax({
			type: "post",
			url: "${ctx}/loginData/createAdminUser",
			dataType: "json",
			data : JSON.stringify(createAdminInfo),
			async:false,
			contentType: "application/json;charset=utf-8",
			success: function(result) {
					layer.msg("创建成功!");
				return ;
			},
			error: function(req, error, errObj) {
			}
		});
	
}
</script>
<%@include file="../base/frameFoot.jsp" %>
